﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;

namespace AdferInternals
{
    public class RestoringMachine
    {
        private readonly BackgroundWorker _backgroundWorker;
        private Bitmap _resultBitmap;

        public RestoringMachine()
        {
            _backgroundWorker = new BackgroundWorker();
            _backgroundWorker.DoWork += _backgroundWorker_DoWork;
        }

        void _backgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            // Restore code here.
            var bitmap = e.Argument as Bitmap;
            var matrix = BitmapHelper.GetMatrix(bitmap);
        }

        public Bitmap Restore(Bitmap bitmap)
        {
            if(_backgroundWorker.IsBusy)
            {
                return new Bitmap(0,0);
            }

            _backgroundWorker.RunWorkerAsync(bitmap);
            return _resultBitmap;
        }
    }
}
